﻿@{
    ViewBag.Title = "Test";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

@section head{
    <link href="~/Scripts/bower_components/jPages/css/jPages.css" rel="stylesheet"/>
    <link href="~/Scripts/bower_components/jPages/css/animate.css" rel="stylesheet"/>
    <style>
        .edit, .editer { width: 200px; }

        .table-no { border-left: 30px; }

        .am-u-sm-10 {
            padding-left: 5px;
            padding-top: 10px;
        }

        .am-form { margin-top: 30px; }
    </style>
}
<div class="am-cf am-padding">
    <div class="am-fl am-cf">
        <strong class="am-text-primary am-text-lg">目录</strong> / <small>Table</small>
    </div>
</div>
<div class="am-g">
    <div class="am-u-md-6 am-cf">
        <div class="am-fl am-cf">
            <div class="am-btn-toolbar am-fl">
                <div class="am-btn-group am-btn-group-xs">
                    <button type="button" class="am-btn am-btn-default" id="addbutton"><span class="am-icon-plus"></span> 新增</button>
                </div>
            </div>
        </div>
    </div>
    <form class="am-form-inline" role="form" method="POST" action="/admin/manage/TestAdd" id="addform">
        <div class="am-form-group ">
            <input type="text" class="am-form-field" name="name" placeholder="请输入测试名字" required="" maxlength="50">
        </div>
        <div class="am-form-group ">
            <input type="time" class="am-form-field" name="time" placeholder="请输入测试时间" required="" style="height: 43px">
        </div>
        <button type="submit" class="am-btn am-btn-default">确定</button>
    </form>
</div>

<div class="am-g">
    <div class="am-u-sm-12">
        <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main" id="table">
                <thead>
                <tr>
                    <th class="table-name">名字</th>
                    <th class="table-date">考试时间</th>
                    <th class="table-set">操作</th>
                </tr>
                </thead>
                <tbody id="itemContainer">
                @if (ViewBag.count == 0)
                {
                        @*@: 无信息！*@
                }
                else
                {
                    var i = 1;
                    foreach (var Tempx in ViewBag.list)
                    {
                        <tr id="@Tempx.ID">
                            <td hidden="hidden" class="ider"> @Tempx.ID</td>
                            <td class="edit nameer">@Tempx.Name</td>
                            <td class="edit timeer">@Tempx.Time</td>
                            <td>
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
                                        <a href="/admin/manage/Getscore/@Tempx.ID" class=" am-btn am-btn-default am-btn-xs"><span class="am-icon-copy"></span>查看成绩</a>

                                        <a href="/admin/manage/Test_getquestions/@Tempx.ID" class=" am-btn am-btn-default am-btn-xs"><span class="am-icon-copy"></span>查看习题</a>
                                        <a href="/admin/manage/Test_addquestions/@Tempx.ID" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑试卷</a>
                                        <a href="/Admin/Manage/TestDel/@Tempx.ID" class=" am-btn am-btn-default am-btn-xs am-text-danger"><span class="am-icon-trash-o"></span> 删除</a>

                                    </div>
                                </div>
                            </td>
                        </tr>
                        i++;
                    }
                }
                </tbody>
            </table>
            <div class="am-cf">
                共 @ViewBag.count 条记录
                <div class="am-fr">
                    <div class="holder am-pagination"></div>
                </div>
            </div>
            <hr/>
            <p id="xxx">注：哇哈哈哈哈哈哈哈</p>
        </form>
    </div>
</div>


@section scripts{


    <script src="~/Scripts/Other/jquery.editable-1.3.3.js"></script>
    <script src="~/Scripts/Other/jpages.js"></script>
    <script src="~/Scripts/Other/jquery.tablesorter.js"></script>

    <script>

        $("#addbutton").click(function() { $("#addform").show(); });

        $(function() {
            $("#addform").hide();
            $("#table").tablesorter({ sortList: [[1, 0]] });
            $("div.holder").jPages({
                containerID: "itemContainer",
                perPage: 15
            });


            $(".edit").editable({
                onSubmit: function() {
                    var ider = this.parent().find(".ider").text();
                    var nameer = this.parent().find(".nameer").text();
                    var timeer = this.parent().find(".timeer").text();
                    $.ajax({
                        type: "post",
                        url: '/admin/manage/TestUpdate',
                        data: {
                            id: ider,
                            name: nameer,
                            time: timeer
                        }
                    });
                }
            });


        });
    </script>

}